//
//  MusicPlayModelTableViewCell.m
//  ToWhere
//
//  Created by dllo on 15/11/23.
//  Copyright © 2015年 www.TE.com. All rights reserved.
//

#import "MusicPlayModelTableViewCell.h"

@interface MusicPlayModelTableViewCell()

@property(nonatomic, retain) UIImageView *imageview;

@property(nonatomic, retain) UILabel *label;

@end

@implementation MusicPlayModelTableViewCell

- (void)dealloc
{
    [_image release];
    [_model release];
    [_imageview release];
    [_label release];
    [super dealloc];
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imageview = [[UIImageView alloc]init];
        [self.contentView addSubview:self.imageview];
        [_imageview release];
        
        self.label = [[UILabel alloc]init];
        self.label.textColor = [UIColor whiteColor];
        self.label.font = [UIFont systemFontOfSize:15 * kWidth];
        [self.contentView addSubview:self.label];
        [_label release];
    }
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    self.imageview.frame = CGRectMake(10 * kWidth, 10 * kHeight, 30 * kWidth, 20 * kHeight);
    self.label.frame = CGRectMake(47 * kWidth, 5 * kHeight, 80 * kWidth, 30 * kHeight);
}

-(void)setImage:(NSString *)image
{
    if (_image != image) {
        [_image release];
        _image = [image copy];
    }
    self.imageview.image = [UIImage imageNamed:image];
}

-(void)setModel:(NSString *)model
{
    if (_model != model) {
        [_model release];
        _model = [model copy];
    }
    self.label.text = model;
}

@end
